package com.xsz.common.util;

import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Random;

public class KeyUtil {

    /**
     * 生成唯一的主�?
     * 格式: 时间+随机�?
     * @return
     */
    public static  String genUniqueKey() {
        Random random = new Random();
        Integer number = random.nextInt(900000) + 100000;

        return System.currentTimeMillis() + String.valueOf(number);
    }

    public static  String getTime() {
        //我要获取当前的日期
        Date date = new Date();
        //设置要获取到什么样的时间
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //获取String类型的时间
        String createdate = sdf.format(date);
        return createdate;
    }
    public static List<String> getAnswer(String a) {
        String demo = a.replaceAll("\"","");
        String demosub = demo.substring(1,demo.length()-1);
        String demoArray[] = demosub.split(",");
        List<String> answers =  Arrays.asList(demoArray);
        return answers;
    }
}

